﻿namespace BLL.Utility
{
    public class PageInfo
    {
        public PageInfo(int currentPage = 1, int pageSize = 10)
        {
            currentPage = currentPage < 1 ? 1 : currentPage;
            pageSize = pageSize < 1 ? 10 : pageSize;
            CurrentPage = currentPage;
            PageSize = pageSize;
        }

        public int TotalPage
        {
            get
            {
                if (TotalRecords < 1)
                {
                    return 0;
                }
                return TotalRecords % PageSize == 0 ? TotalRecords / PageSize : TotalRecords / PageSize + 1;
            }
        }

        public int CurrentPage { get; set; }

        public int TotalRecords { get; set; }

        public int PageSize { get; set; }

    }
}